import React, { Component } from 'react';
import './Swipe.scss'
import { index_banner } from '../utils/api'
import { Swiper } from 'antd-mobile'
class Swipe extends Component {
    constructor(props) {
        super(props)
        this.state = {
            piclist: []
        }
    }
    componentDidMount() {
        index_banner().then((res) => {
            if (res.data.code == 200) {
                console.log(res.data)
                this.setState({ piclist: res.data.list })
            }
        })
    }
    render() {
        return (
            <div className='swiper'>
                <Swiper autoplay loop>
                    {
                        this.state.piclist.map((element, index) => {
                            return (
                                <Swiper.Item key={index} >
                                    <img src={element.pic} alt="" />
                                </Swiper.Item>
                            )
                        })
                    }
                </Swiper >
            </div>
        );
    }
}

export default Swipe;